package com.tomato.displaySample;

import java.util.ArrayList;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.sax.StartElementListener;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.TextView;

public class sequance_customView extends Activity 
{



	static class SequanceItem
	{
		TextView listNum;
		Button defSequanceview_customListDataValue2;
		Button defSequanceview_customListDataValue3;
		Button defSequanceview_customListDataValue4;
		Button defSequanceview_customListDataValue5;
		Button defSequanceview_customListDataValue6;
	}
	
	static class SequanceDataItem
	{
		String listNum;
		String ListDataValue1;
		String ListDataValue2;
		String ListDataValue3;
		String ListDataValue4;
		String ListDataValue5;
		
		SequanceDataItem(String num,String data1,String data2,String data3,String data4,String data5)
		{
			listNum	= num;
			ListDataValue1 = data1;
			ListDataValue2 = data2;
			ListDataValue3 = data3;
			ListDataValue4 = data4;
			ListDataValue5 = data5;
		}
	}
	
	static class SequanceListAdapter extends BaseAdapter
	{
		Context maincon;
		LayoutInflater Inflater;
		ArrayList<SequanceDataItem> arSrc;
		int layout;
		public SequanceListAdapter(Context context,int alayout, ArrayList<SequanceDataItem>aarSrc)
		{

			maincon = context;
			Inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			arSrc = aarSrc;
			layout = alayout;
		}

		@Override
		public int getCount() {
			// TODO Auto-generated method stub
			return arSrc.size();
		}

		@Override
		public Object getItem(int position) {
			// TODO Auto-generated method stub
			return arSrc.get(position);
		}

		@Override
		public long getItemId(int position) {
			// TODO Auto-generated method stub
			return position;
		}

		SequanceItem holder;
		@Override
		public View getView(int position, View convertView, ViewGroup parent) 
		{
		
			 holder = new SequanceItem();
			// TODO Auto-generated method stub
			if(convertView==null)
			{
				convertView = Inflater.inflate(R.layout.sequanceview_customlist,null);

			holder.listNum = (TextView) convertView.findViewById(R.id.sequanceview_customListDataValue1);
			holder.listNum.setText(String.valueOf(position+1));

			holder.defSequanceview_customListDataValue2 = (Button)convertView.findViewById(R.id.sequanceview_customListDataValue2);
//			holder.defSequanceview_customListDataValue2.setOnClickListener(new OnClickListener() {
//				
//				@Override
//				public void onClick(View v) {
//					// TODO Auto-generated method stub
//					holder.defSequanceview_customListDataValue2.setText("test");
//				}
//			});
			holder.defSequanceview_customListDataValue3 = (Button)convertView.findViewById(R.id.sequanceview_customListDataValue3);
			holder.defSequanceview_customListDataValue4 = (Button)convertView.findViewById(R.id.sequanceview_customListDataValue4);
			holder.defSequanceview_customListDataValue5 = (Button)convertView.findViewById(R.id.sequanceview_customListDataValue5);
			holder.defSequanceview_customListDataValue6 = (Button)convertView.findViewById(R.id.sequanceview_customListDataValue6);
			
			
//			holder.defSequanceview_customListDataValue3.setOnClickListener(button_Listener);
//			holder.defSequanceview_customListDataValue4.setOnClickListener(button_Listener);
//			holder.defSequanceview_customListDataValue5.setOnClickListener(button_Listener);
//			holder.defSequanceview_customListDataValue6.setOnClickListener(button_Listener);
			convertView.setTag(holder);
			
			}else{
			 holder = (SequanceItem) convertView.getTag();
			}
			
			return convertView;
		}
//		private OnClickListener button_Listener=new OnClickListener() {
//			@Override
//			public void onClick(View v) {
//				switch(v.getId()){
//					case R.id.sequanceview_customListDataValue2:
//					{
//						holder.defSequanceview_customListDataValue2.setText("test");
//						break;
//					}
//					case R.id.sequanceview_customListDataValue3:
//					{
//						holder.defSequanceview_customListDataValue3.setText("test");
//						break;
//					}
//					case R.id.sequanceview_customListDataValue4:
//					{
//						holder.defSequanceview_customListDataValue4.setText("test");
//						break;
//					}
//					case R.id.sequanceview_customListDataValue5:
//					{
//						holder.defSequanceview_customListDataValue5.setText("test");
//						break;
//					}
//					case R.id.sequanceview_customListDataValue6:
//					{
//						holder.defSequanceview_customListDataValue6.setText("test");
//						break;
//					}
//				}
//			}
//		};
	}
}
